#include "time.h"
#include "lock.h"
#include "riscv.h"
#include "stdio.h"
spinlock_t time_lk;

#include "dbg.h"

#ifdef DEBUG
int times = 0;
#endif

void
setNextTime(void) {
    // #ifdef DEBUG
    // printf("setNextTime: %d\n", times);
    // times++;
    // if(times == 2)
    //     while(1);
    // #endif
    // printf("");
    sbi_set_time(r_time() + TICKS);
}

void
timerInit(void) {
    __DEBUG_FUNC_START;
    spinlock_init(&time_lk, "time");
    __DEBUG_FUNC_END;
}
